﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="HoaDon.aspx.cs" Inherits="XuaNhapKho.HoaDon" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="breadLine">
        <ul class="breadcrumb">
            <li><a href="#">Hệ thống quản lý xuất nhập kho</a> <span class="divider">></span></li>
            <li class="active">Hóa đơn</li>
        </ul>
    </div>
    <div class="workplace">
        <div class="row-fluid">
            <div class="span12">
                <div class="wBlock yello auto">
                    <div class="dSpace">
                        <h3>
                            Số lượng hóa đơn</h3>
                        <span class="mChartBar" sparktype="bar" sparkbarcolor="white">
                            <!--2,5,3,5,6,7,9,8,5,6,2,5-->
                        </span><span class="number">
                            <asp:Literal ID="ltlTongHoaDon" runat="server"></asp:Literal>
                        </span>
                    </div>
                </div>
                <div class="wBlock blue auto">
                    <div class="dSpace">
                        <h3>
                            Số lượng hóa đơn nhập</h3>
                        <span class="mChartBar" sparktype="bar" sparkbarcolor="white">
                            <!--5,10,15,20,23,21,25,20,15,10,25,20,10-->
                        </span><span class="number">
                            <asp:Literal ID="ltlTongHoaDonNhap" runat="server"></asp:Literal></span>
                    </div>
                </div>
                <div class="wBlock gray auto">
                    <div class="dSpace">
                        <h3>
                            Số lượng hóa đơn xuất</h3>
                        <span class="mChartBar" sparktype="bar" sparkbarcolor="white">
                            <!--5,10,15,20,23,21,25,20,15,10,25,20,10-->
                        </span><span class="number">
                            <asp:Literal ID="ltlTongHoaDonXuat" runat="server"></asp:Literal></span>
                    </div>
                </div>
                <div class="wBlock green auto">
                    <div class="dSpace">
                        <h3>
                            Tổng tiền</h3>
                        <span class="mChartBar" sparktype="bar" sparkbarcolor="white">
                            <!--5,10,15,20,23,21,25,20,15,10,25,20,10-->
                        </span><span class="number">
                            <asp:Literal ID="ltlTongTien" runat="server"></asp:Literal>  VND</span>
                    </div>
                </div>
                <div class="wBlock red auto">
                    <div class="dSpace">
                        <h3>
                            Số tiền nợ</h3>
                        <span class="mChartBar" sparktype="bar" sparkbarcolor="white">
                            <!--5,10,15,20,23,21,25,20,15,10,25,20,10-->
                        </span><span class="number">
                            <asp:Literal ID="ltlTongTienNo" runat="server"></asp:Literal>  VND</span>
                    </div>
                </div>
                <div class="wBlock green auto">
                    <div class="dSpace">
                        <h3>
                            Số tiền thu</h3>
                        <span class="mChartBar" sparktype="bar" sparkbarcolor="white">
                            <!--5,10,15,20,23,21,25,20,15,10,25,20,10-->
                        </span><span class="number">
                            <asp:Literal ID="ltlTongTienThu" runat="server"></asp:Literal> VND</span>
                    </div>
                </div>
                
            </div>
        </div>

        <div class="row-fluid">
            <div class="span12">
                <div class="head">
                    <div class="isw-grid">
                    </div>
                    <h1>
                        Tìm kiếm hóa đơn</h1>
                    <div class="clear">
                    </div>
                </div>
                <div class="block">
                    Tìm kiếm theo hóa đơn 
                    <asp:TextBox ID="txtMaHoaDon" runat="server"></asp:TextBox>
                    <asp:DropDownList ID="ddlLoaiHoaDon"  runat="server">
                        <asp:ListItem Value="0" Text="Tất cả"></asp:ListItem>
                        <asp:ListItem Value="1" Text="Nhập kho"></asp:ListItem>
                        <asp:ListItem Value="2" Text="Xuất kho"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:Button ID="btnSearch"  CssClass="btn" 
                        style="height : 30px; margin-top: -7px;" runat="server" Text="Tìm kiếm hóa đơn" 
                        onclick="btnSearch_Click" />
                </div>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
                <div class="head">
                    <div class="isw-grid">
                    </div>
                    <h1>
                        Danh sách hóa đơn</h1>
                    <div class="clear">
                    </div>
                </div>
                <div class="block-fluid">
                    <asp:GridView ID="grvHoaDon"  BorderStyle="None" GridLines="None"  
                        CssClass="table" runat="server" AutoGenerateColumns="False" AllowPaging="True" 
                        onpageindexchanging="grvHoaDon_PageIndexChanging">
                        <Columns>
                         
                            <asp:TemplateField HeaderText="Mã hóa đơn">
                                <ItemTemplate>
                                    
                                    <asp:LinkButton ID="lbtnDetail" runat="server" 
                                        CommandArgument='<%# Eval("MaHoaDon") %>' oncommand="lbtnDetail_Command" 
                                        Text='<%# Eval("MaHoaDon") %>' CommandName='<%# Eval("LoaiHoaDon") %>'></asp:LinkButton>
                                    
                                </ItemTemplate>
                                
                            </asp:TemplateField>
                         
                           <asp:TemplateField HeaderText="Tổng tiền">
                                <ItemTemplate>
                                    <%# String.Format("{0:0,0}",Double.Parse(Eval("TongTien").ToString()))  %>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Tiền trả">
                                <ItemTemplate>
                                    <%# String.Format("{0:0,0}",Double.Parse(Eval("TienTra").ToString()))  %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Tiền Nợ">
                                <ItemTemplate>
                                    <%# String.Format("{0:0,0}",Double.Parse(Eval("TienNo").ToString()))  %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Loại hóa đơn">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("LoaiHoaDon").ToString() == "1" ? "Nhập kho" : "Xuất kho" %>'></asp:Label>
                                </ItemTemplate>
                                
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Ngày xuất hóa đơn">
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("NgayXuatHoaDon","{0:dd/MM/yyyy | HH:mm}") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>


                        </Columns>
                    </asp:GridView>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
